
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<html class="no-js">
<head>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>登陆</title> 
  <link rel="stylesheet" href="${ctx }/mobile/css/amazeui.min.css">  
  <link rel="stylesheet" href="${ctx }/css/app.css">
  <link href="${ctx }/css/public.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="${ctx}/jquery-easyui-1.4.5/jquery.min.js"></script>
	<script type="text/javascript" src="${ctx}/jquery-easyui-1.4.5/jquery.easyui.min.js"></script>
  	<%@ include file="../include.jsp" %>
</head>

<script>


	function submitLoginForm() {
		var utel=document.getElementById("phone");
		var str=utel.value;
		var regPartton=/1[3-8]+\d{9}/;		
		 if(!str || str==null){
			ShowTip("手机号码不能为空！");
		}else if(!regPartton.test(str)){
			ShowTip("手机号码格式不正确！");
		}else{	
			
			
			$("#loginForm").submit(function () {
	            $(this).ajaxSubmit(function () {
	                alert("提交成功1");
	            });
	            return false;
	        });
			  $('#loginForm').form('submit', {
				url : '${ctx}/mobile/gologin',
				dataType : 'json',
				success : function(result) {
					var json = $.parseJSON(result);
					if (json.success == 0) {
						console.log(json.obj);
						setCookieDefault("USER_TOKEN",json.obj)
						window.location.href = "${ctx}/mobile/mainCart";
					} else if (json.success == 1) {
						ShowTip("用户名密码错误");
					} else {
						ShowTip(json.msg);
					}
				}
			}); 
		} 
	}
	
	
	function goregister(){
		window.location.href = "${ctx}/mobile/goRegister";
	}
	
</script>
<body>
<div class="am-g">
	<!-- LOGO -->
	 <div class="am-u-sm-12 am-text-center myapp-login-top" >
	 	<div class="am-u-sm-12 am-text-center myapp-login-top" >
	 	 	<i class="am-icon-twitch myapp-login-top"></i>
	 	 </div>
	</div> 
	<!-- 登陆框 -->
	<div class="am-u-sm-11 am-u-sm-centered">
	<form id="loginForm" class="am-form" method="post" >
	  <fieldset class="myapp-login-form am-form-set">
		<div class="am-form-group am-form-icon">
			<i class="am-icon-user"></i>
			<input  type="text" id="phone" name="phone" class="myapp-login-input-text am-form-field" placeholder="请输入您的手机号码">
		</div>
	    <div class="am-form-group am-form-icon">
			<i class="am-icon-lock"></i>
			<input type="password" name="userPwd"  class="myapp-login-input-text am-form-field" placeholder="至少6个字符">
		</div>
	  </fieldset>
	  <div   class="myapp-login-form-submit am-btn am-btn-primary am-btn-block " onclick="submitLoginForm()">登 录</div>
	</form>
		  
	<div type="submit" class="myapp-login-form-submit am-btn am-btn-primary am-btn-block " onclick="goregister()">注 册</div>
	</div>

</div>
</body>
</html>